﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace dzs.Web.qualitysked1
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtprojectunit.Text.Trim().Length==0)
			{
				strErr+="项目单位不能为空！\\n";	
			}
			if(this.txtprojectname.Text.Trim().Length==0)
			{
				strErr+="projectname不能为空！\\n";	
			}
			if(this.txtsupplier.Text.Trim().Length==0)
			{
				strErr+="supplier不能为空！\\n";	
			}
			if(this.txtproductname.Text.Trim().Length==0)
			{
				strErr+="productname不能为空！\\n";	
			}
			if(!PageValidate.IsDecimal(txtproductnum.Text))
			{
				strErr+="productnum格式错误！\\n";	
			}
			if(this.txtproductdw.Text.Trim().Length==0)
			{
				strErr+="productdw不能为空！\\n";	
			}
			if(this.txtengineer.Text.Trim().Length==0)
			{
				strErr+="监造单位不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtonstreamtime.Text))
			{
				strErr+="onstreamtime格式错误！\\n";	
			}
			if(this.txtengineermode.Text.Trim().Length==0)
			{
				strErr+="监造方式不能为空！\\n";	
			}
			if(this.txtproductionstate.Text.Trim().Length==0)
			{
				strErr+="productionstate不能为空！\\n";	
			}
			if(this.txtengineeropinion.Text.Trim().Length==0)
			{
				strErr+="监造意见不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txtplandate.Text))
			{
				strErr+="plandate格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtuid.Text))
			{
				strErr+="质量员ID格式错误！\\n";	
			}
			if(this.txtqresult.Text.Trim().Length==0)
			{
				strErr+="处理结果不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string projectunit=this.txtprojectunit.Text;
			string projectname=this.txtprojectname.Text;
			string supplier=this.txtsupplier.Text;
			string productname=this.txtproductname.Text;
			decimal productnum=decimal.Parse(this.txtproductnum.Text);
			string productdw=this.txtproductdw.Text;
			string engineer=this.txtengineer.Text;
			DateTime onstreamtime=DateTime.Parse(this.txtonstreamtime.Text);
			string engineermode=this.txtengineermode.Text;
			string productionstate=this.txtproductionstate.Text;
			string engineeropinion=this.txtengineeropinion.Text;
			DateTime plandate=DateTime.Parse(this.txtplandate.Text);
			int uid=int.Parse(this.txtuid.Text);
			string qresult=this.txtqresult.Text;

			dzs.Model.qualitysked1 model=new dzs.Model.qualitysked1();
			model.projectunit=projectunit;
			model.projectname=projectname;
			model.supplier=supplier;
			model.productname=productname;
			model.productnum=productnum;
			model.productdw=productdw;
			model.engineer=engineer;
			model.onstreamtime=onstreamtime;
			model.engineermode=engineermode;
			model.productionstate=productionstate;
			model.engineeropinion=engineeropinion;
			model.plandate=plandate;
			model.uid=uid;
			model.qresult=qresult;

			dzs.BLL.qualitysked1 bll=new dzs.BLL.qualitysked1();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","Add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
